<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=encoding">
<title>VLCShares Installation script</title>
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js "></script>-->
<script src="includes/js/jquery.js" type="text/javascript"></script>
<script src="includes/js/jquery-ui.js" type="text/javascript"></script>
<script src="includes/js/jquery.serverBrowser.js" type="text/javascript"></script>
<link href="includes/css/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="includes/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

$(document).ready(function(){

	$('#show-advanced').click(function(event){
		if ( $(this).attr('checked') ) {
			$('.advanced').show();
			$('.advanced input').removeAttr('disabled');
			$('.advanced select').removeAttr('disabled');
		} else {
			$('.advanced input').attr('disabled', 'disabled');
			$('.advanced select').attr('disabled', 'disabled');
			$('.advanced').hide();
		}
	});

	$('#frm-vlc-commander-name').change(function(event){
		$('#frm-vlc-commander-path').attr('value',$('#frm-vlc-commander-name option:selected').attr('title'));
	});

	$('#frm-vlc-path').parent().append('<input id="browse_frm-vlc-path" type="button" class="ui-corner-all ui-state-default" value="Browse" />');
	$('#frm-vlc-path').parent().append('<input id="autosearch_frm-vlc-path" type="button" class="ui-corner-all ui-state-default" value="Auto-search" />');
	$('#browse_frm-vlc-path').serverBrowser({
	    onSelect: function(path) {
	        $('#frm-vlc-path').val(path);
	    },
	    onLoad: function() {
	    	$('#frm-vlc-path').val('');
	        return '';
	    },
	    knownPaths: [],
	    imageUrl: 'includes/img/icons/',
	    systemImageUrl: 'includes/img/browser/',
	    handlerUrl: 'includes/getpath.php',
	    title: 'VLC Path',
	    basePath: '',
	    requestMethod: 'POST'
	});
	$('#autosearch_frm-vlc-path').click(function (event){
		$.getJSON('includes/vlcautosearch.php', function(data){
			if ( !data.error ) {
				$('#frm-vlc-path').val(data.path);
			}
		});
	});
		
	
	$('.advanced input').attr('disabled', 'disabled');
	$('.advanced select').attr('disabled', 'disabled');
	$('.advanced').hide();
	
});
</script>
<style type="text/css">
</style>
</head>
<body>
	<h1>VLCShares Installation script</h1>
	<!-- Messaggi -->
	<?php if (count($this->messages)):?>
	<div id="messenger">
		<ul>
			<?php foreach($this->messages as $message):?>
				<li class="<?php echo $message[1];?>"><?php echo $message[0]; ?></li>
			<?php endforeach; ?>
		</ul>
	</div>
	<?php endif; ?>
	<noscript>
		<div class="noscript">
			<p class="warning">Javascript disabled: lots of cool things will not work well</p>
		</div>
	</noscript>
	<pre><?php echo print_r($_POST, true); ?></pre>
	<!-- Corpo -->
	<div id="form">
		<input type="checkbox" id="show-advanced" name="show-advanced" /> <label for="show-advanced">Show advanced configs</label>
		<form action="?action=install" method="post">
			<fieldset>
				<legend>General configs</legend>
				<dl>
					<dt>Language</dt>
					<dd>
						<select id="frm-general-languageFile" name="configs[general][languageFile]">
							<?php foreach ($this->general_languages as $language): ?>
								<option <?php echo @$language['selected']; ?> value="<?php echo $language['value'];?>">
									<?php echo $language['label']; ?>
								</option>
							<?php endforeach; ?>
						</select>
					</dd>
					<dt class="advanced">Debug enabled?</dt>
					<dd class="advanced">
						<select id="frm-general-debug_enabled" name="configs[general][debug_enabled]">
							<option selected="selected" value="false">No</option>
							<option value="false">Yes</option>
						</select>
					</dd>
					<dt class="advanced">Debug file path</dt>
					<dd class="advanced">
						<input type="text" id="frm-general-debug_path" name="configs[general][debug_path]" value="<?php echo $this->general_debug_path; ?>" />
					</dd>
					<dt>Apache port</dt>
					<dd>
						<input type="text" id="frm-general-apache_altPort" name="configs[general][apache_altPort]" value="<?php echo $this->general_apache_altPort; ?>" />
					</dd>
				</dl>
			</fieldset>
			<fieldset>
				<legend>VLC configs</legend>
				<dl>
					<dt>Vlc path</dt>
					<dd>
						<input type="text" id="frm-vlc-path" name="configs[vlc][path]" value="<?php echo $this->vlc_path; ?>" />
					</dd>
					<dt class="advanced">Vlc args</dt>
					<dd class="advanced">
						<input type="text" id="frm-vlc-args" name="configs[vlc][args]" value="<?php echo $this->vlc_args; ?>" />
					</dd>
					<dt class="advanced">Stream address</dt>
					<dd class="advanced">
						<input type="text" id="frm-vlc-stream" name="configs[vlc][stream]" value="<?php echo $this->vlc_stream; ?>" />
					</dd>
					<dt class="advanced">Adapter class</dt>
					<dd class="advanced">
						<select id="frm-vlc-adapter-name" name="configs[vlc][adapter][name]">
							<?php foreach ($this->vlc_adapters as $adapter): ?>
								<option <?php echo @$adapter['selected']; ?> value="<?php echo $adapter['value'];?>">
									<?php echo $adapter['label']; ?>
								</option>
							<?php endforeach; ?>
						</select>
					</dd>
					<dt class="advanced">Adapter pid file</dt>
					<dd class="advanced">
						<input type="text" id="frm-vlc-adapter-pidFile" name="configs[vlc][adapter][pidFile]" value="<?php echo $this->vlc_adapter_pidFile; ?>" />
					</dd>
					<dt class="advanced">Commander class</dt>
					<dd class="advanced">
						<select id="frm-vlc-commander-name" name="configs[vlc][commander][name]">
							<?php foreach ($this->vlc_commanders as $commander): ?>
								<option <?php echo @$commander['selected']; ?> value="<?php echo $commander['value'];?>" title="<?php echo $commander['path']; ?>">
									<?php echo $commander['label']; ?>
								</option>
								<?php if (@$commander['selected'] != '' ) $selectedCommanderPath = $commander['path']; ?>
							<?php endforeach; ?>
						</select>
						<input id="frm-vlc-commander-path" type="hidden" name="configs[vlc][commander][path]" value="<?php echo @$selectedCommanderPath; ?>" />
					</dd>
				</dl>
			</fieldset>
			<?php foreach($this->vlc_commanders as $commander):?>
				<fieldset class="advanced">
					<legend>Commander <?php echo $commander['label'];?> options</legend>
					<dl>
						<?php foreach ($commander['options'] as $option) :?>
							<dt><?php echo $option['label']; ?></dt>
							<dd>
								<input type="text" id="frm-vlc-commander-<?php echo $option['name']?>" name="configs[vlc][commander][<?php echo $option['name']; ?>]" value="<?php echo $option['value']; ?>" />
							</dd>
						<?php endforeach; ?>
					</dl>
				</fieldset>
			<?php endforeach; ?>
			<fieldset>
				<input type="reset" /> <input type="submit" />
			</fieldset>
		</form>
	</div>
</body>
</html>